package avicit.bdp.dgs.metadata.compare.pojo;

import java.util.Objects;

/**
 * @author mayi
 * @param <T>
 */
public abstract class DiffItem<T> {

  /** 新表 */
  private final T newTable;

  /** 旧表 */
  private final T oldTable;

  private String key;

  private String type;

  public DiffItem(T ot, T nt) {
    this.oldTable = ot;
    this.newTable = nt;
  }

  public T getOldTable() {
    return oldTable;
  }

  public T getNewTable() {
    return newTable;
  }

  public String getKey() {
    return key;
  }

  public void setKey(String key) {
    this.key = key;
  }

  public String getType() {
    return type;
  }

  public void setType(String type) {
    this.type = type;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    DiffItem<?> that = (DiffItem<?>) o;
    return Objects.equals(key, that.key);
  }

  @Override
  public int hashCode() {
    return Objects.hash(key);
  }
}
